export let find = {
  namespaced: true,
  state: {
    banner_data: {},
    personalized_data: {},
    album_data: {},
  },
  actions: {
    getBannerData(store, data = {}) {
      let url = "/banner?type=" + data.type;
      axios.get(url).then(({
        data
      }) => {
        store.commit("setBannerData", data);
      });
    },
    getPersonalizedData(store, data = {}) {
      let url = "/personalized?limit=" + data.limit;
      axios.get(url).then(({
        data
      }) => {
        store.commit("setPersonalizedData", data)
      });
    },
    getAlbumData(store, data = {}) {
      let url = "/top/album?offset=" + data.offset + "&limit=" + data.limit;
      axios.get(url).then(({
        data
      }) => {
        store.commit("setAlbumData", data)
      });
    },
  },
  mutations: {
    setBannerData(state, data) {
      state.banner_data = data;
    },
    setPersonalizedData(state, data) {
      state.personalized_data = data;
    },
    setAlbumData(state, data) {
      state.album_data = data;
    },
  }
}
